<template>
  <div>

    <sticky>
      <x-header :left-options="{showBack: false}">后台管理</x-header>
    </sticky>

    <group>
      <cell title="人员管理" is-link link="personnel-s"></cell>
      <!--<cell title="排版管理" is-link link="schedule-list-s"></cell>-->
      <cell title="排版安排" is-link link="schedule-s"></cell>
      <!--<cell title="预约保洁" is-link link="personnel"></cell>-->
      <!--<cell title="报修管理" is-link link="personnel"></cell>-->
      <cell title="每周食谱" is-link link="recipe-s"></cell>
      <cell title="消息通知" is-link link="message-s"></cell>
    </group>
  </div>
</template>

<script type="text/ecmascript-6">
  import {
    Cell,
    Group,
    XHeader,
    Sticky
  } from 'vux'

  export default {
    components: {
      Group,
      Cell,
      XHeader,
      Sticky
    },
    data() {
      return {
        canInit: false
      }
    },
    mounted() {
      this.$http.get('/api/me').then((r) => {
        r.data.data.roles.forEach((item) => {
          if (item.id === 1) {
            this.canInit = true
          }
        })
        if (!this.canInit) {
          this.$vux.alert.show({
            title: '提示',
            content: '需要管理员权限',
            onHide() {
//              window.close()
              WeixinJSBridge.call('closeWindow')
            }
          })
        }
      })
    }
  }
</script>

<style>

</style>
